import { LOGIN_TOKEN } from '@/global/constans'
import hyRequest from '@/service'
import { LoginForm } from '@/types'
import { localCache } from '@/utils/cache'
export function accountLoginRequest(data: LoginForm) {
  return hyRequest.post({
    url: '/login',
    data
  })
}

export function getUserInforById(id: number) {
  return hyRequest.get({
    url: `/users/${id}`,
    headers: {
      Authorization: `Bearer ${localCache.getCache(LOGIN_TOKEN)}`
    }
  })
}

export function getUserMenusByRoleId(id: number) {
  return hyRequest.get({
    url: `/role/${id}/menu`,
    headers: {
      Authorization: `Bearer ${localCache.getCache(LOGIN_TOKEN)}`
    }
  })
}
